package org.jeecg.common.util.upgrade;

import lombok.Data;
import org.jeecg.common.util.enums.AppUpgradeStrategyEnum;
import org.jeecg.common.util.enums.StatusEnum;

import java.util.Objects;

/**
 * @author guoyh
 * @ClassName AppUpgradeResponseVo
 * @Description
 * @since 2020/9/6 15:57
 **/
@Data
public class AppUpgradeResponseVo {

    /**
     * 升级策略  0 无需升级   1  选择升级   2强制升级
     */
    private Integer upgradeStrategy;

    /**
     * 升级地址
     */
    private String url;

    /**
     * 升级文案
     */
    private String content;

    /**
     * 是否审核中
     */
    private Boolean isAudit;

    /**
     * 构建无需升级函数
     * @return
     */
    public static AppUpgradeResponseVo buildNone(Integer appAudit){
        AppUpgradeResponseVo appUpgradeResponseVo = new AppUpgradeResponseVo();
        appUpgradeResponseVo.setUpgradeStrategy(AppUpgradeStrategyEnum.NONE.getCode());
        appUpgradeResponseVo.setIsAudit(Objects.equals(appAudit, StatusEnum.VALID.getCode()));
        return appUpgradeResponseVo;
    }

}
